package nccloud.rongq.bill.rongqvo.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import nc.arap.pub.cons.SQLCons;
import nc.itf.uap.IUAPQueryBS;
import nc.jdbc.framework.processor.MapListProcessor;
import nccloud.framework.core.exception.ExceptionUtils;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.web.action.itf.ICommonAction;
import nccloud.framework.web.container.IRequest;

/**
 * 查询业务单元
 * @author ASUS
 *
 */
public class OrgNameRongQVOAction implements ICommonAction {

	@SuppressWarnings("unchecked")
	@Override
	public Object doAction(IRequest request) {
		String read = request.read();
		String sql = SQLCons.getMainJobOrgByUserid(read);
		List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
		try {
			list = (List<Map<String, Object>>) ServiceLocator.find(IUAPQueryBS.class).executeQuery(sql, new MapListProcessor());
		    if(!list.isEmpty()) {
		    	return list.get(0);
		    }else {
		    	ExceptionUtils.wrapBusinessException("查询不到当前用户绑定的人员信息");
		    }
		} catch (Exception e) {
			e.printStackTrace();
			ExceptionUtils.wrapBusinessException(e.getMessage());
		}
		return null;
	}

}
